/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有，侵权必究！
 */

package com.cn.xiaonuo.tcrfinance.tcrusers.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cn.xiaonuo.tcrfinance.tcrusers.entity.PvLoginUser;
import com.cn.xiaonuo.tcrfinance.tcrusers.entity.PvUserEntity;
import com.cn.xiaonuo.tcrfinance.tcrusers.param.ConsignmentParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.param.UserListParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.vo.ConsignmentGoodVo;
import com.cn.xiaonuo.tcrfinance.tcrusers.vo.PvBuySellSummaryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author Mark sunlightcs@gmail.com
 */
@Repository
public interface PvLoginUserMapper extends BaseMapper<PvLoginUser> {


    List<Map<String, Object>> queryUserList(UserListParam params);

    //买入金额
    Double buySumTotalAmount(@Param("accounts") String accounts,
                             @Param("curTime") String curTime);

    //卖出金额
    Double sellSumTotalAmount(@Param("accounts") String accounts,
                              @Param("curTime") String curTime);

    //交易费用
    Double costTotalAmount(@Param("accounts") String accounts,
                           @Param("curTime") String curTime);

    //出金金额
    Double cGoldSumTotalAmount(@Param("accounts") String accounts,
                               @Param("curTime") String curTime);

    //入金金额
    Double rGoldSumTotalAmount(@Param("accounts") String accounts,
                               @Param("curTime") String curTime);

    //查看当天最开始资金余额和当天的余额
    List<Map<String, Object>> queryWalletLogByDate(@Param("accounts") String accounts,
                                                   @Param("curTime") String curTime);

    //报表当日买卖记录
    List<Map<String, Object>> queryBuySellByDate(@Param("accounts") String accounts,
                                                 @Param("curTime") String curTime);

    //报表统计当日买卖总数量
    Double queryBuySellSumNum(@Param("accounts") String accounts,
                              @Param("curTime") String curTime);

    //报表统计当日买卖总额
    Double queryBuySellSumMoney(@Param("accounts") String accounts,
                                @Param("curTime") String curTime);

    //报表统计当日买卖总手续费
    Double queryBuySellSumSXF(@Param("accounts") String accounts,
                              @Param("curTime") String curTime);

    //报表统计当日买卖总70%
    Double queryBuySellSumSeven(@Param("accounts") String accounts,
                                @Param("curTime") String curTime);


    //查询用户当天购买某个商品的总数量
    Double queryBuySumNum(@Param("accounts") String accounts,
                          @Param("curTime") String curTime,
                          @Param("productId") String productId
    );

    //查询用户当天卖出某个商品的总数量
    Double querySellSumNum(@Param("accounts") String accounts,
                           @Param("curTime") String curTime,
                           @Param("productId") String productId);

    //查询用户当天释放某个商品的总数量
    Double querySFSumNum(@Param("accounts") String accounts,
                         @Param("curTime") String curTime,
                         @Param("productId") String productId);


    //查询当天释放某个商品的总数量
    Double querySFSumNumByProductId(
            @Param("curTime") String curTime,
            @Param("productId") String productId);


    //统计用户的某个商品某天卖出的释放量
    Double querySellSFNum(@Param("accounts") String accounts,
                          @Param("curTime") String curTime,
                          @Param("productId") String productId);

    //统计用户的某个商品某天提货数量
    Double queryTHNum(@Param("accounts") String accounts,
                      @Param("curTime") String curTime,
                      @Param("productId") String productId);

    //统计用户的某个商品某天之前所有提货数量总和
    Double queryTHSumNum(@Param("accounts") String accounts,
                         @Param("curTime") String curTime,
                         @Param("productId") String productId);

    //统计用户的某个商品某天总持有量
    Double drSumNum(@Param("accounts") String accounts,
                    @Param("curTime") String curTime,
                    @Param("productId") String productId);


    //统计用户的某个商品某天可用量
    Double drDayAvaNum(@Param("accounts") String accounts,
                       @Param("curTime") String curTime,
                       @Param("productId") String productId);

    //统计用户的某个商品某天上日总持有量
    Double srDayHoldNum(@Param("accounts") String accounts,
                        @Param("curTime") String curTime,
                        @Param("productId") String productId);


    //查询用户当天释放某个商品的总数量
    Double queryNum1(@Param("userId") Integer userId,
                     @Param("productId") Integer productId);

    //查询用户当天释放某个商品的总数量
    Double queryNum2(@Param("userId") Integer userId,
                     @Param("productId") Integer productId);

    //查询用户当天释放某个商品的总数量
    Integer clearVolume();

    //线下银行卡充值记录
    List<Map<String, Object>> offlineRechargeDetailed(PvUserEntity onlineUserRecharge);

    //统计线下银行卡充值总额
    Double offlineRechargeDetailedTotal(PvUserEntity onlineUserRecharge);

    //获取验证银行卡收款订单列表
    List<Map<String, Object>> queryUserYZBankCardInfo(PvUserEntity pvUserEntity);

    //获取验证银行卡收款总额
    Double queryUserYZBankCardInfoSUM(PvUserEntity pvUserEntity);

    List<Map<String, Object>> selectUserInfoAndWallet(PvUserEntity pvUserEntity);

    Double selectUserInfoAndWalletSumMoney(PvUserEntity pvUserEntity);


    /**
     * 查询最大电话号码
     *
     * @return java.lang.String
     */
    String selectMaxPhone();

    List<Map<String, Object>> experienceUserList(UserListParam params);

    List<ConsignmentGoodVo> consignmentTradeDetail(ConsignmentParam consignmentParam);

    PvBuySellSummaryVo tradeSummary(ConsignmentParam consignmentParam);
}
